#include "scorekeeperscreen.h"
#include "ui_scorekeeperscreen.h"

ScoreKeeperScreen::ScoreKeeperScreen(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ScoreKeeperScreen)
{
    ui->setupUi(this);
    keeper=new ScoreKeeper();
    updateValues();
}

ScoreKeeperScreen::~ScoreKeeperScreen()
{
    delete ui;
}

void ScoreKeeperScreen::updateValues(){
    ui->inningValueLabel_3->setText(QString::number(keeper->getInning()));
    ui->outValueLabel->setText(QString::number(keeper->getOuts()));
    ui->strikeValueLabel->setText(QString::number(keeper->getStrikes()));
    ui->balValueLabel->setText(QString::number(keeper->getBalls()));
}

void ScoreKeeperScreen::strike(){
    keeper->incrementStrikes();
    updateValues();
}

void ScoreKeeperScreen::foul(){
    keeper->foulBall();
    updateValues();
}

void ScoreKeeperScreen::ball(){
    keeper->incrementBalls();
    updateValues();
}


